package com.magist.core.enums;

public enum SysMenuEnum implements BaseEnum {
    ROOT("ROOT", "目录"), MENU("MENU", "菜单"), BUTTON("BUTTON", "按钮");
    private String code; // 编号
    private String desc; // 说明信息

    SysMenuEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 从编号得到枚举类
     * @param code
     * @return
     */
    public SysMenuEnum getByCode(String code){
        for(SysMenuEnum e:SysMenuEnum.values()){
            if(e.getCode().equals(code))
                return e;
        }
        return null;
    }
}
